program = """
move_right()
move_right(1)
move_right(2)
move_right(3)
move_up()
move_up(1)
move_up(2)
move_up(3)
move_left()
move_left(1)
move_left(2)
move_left(3)
move_down()
move_down(1)
move_down(2)
move_down(3)
for x in range(2):
    move_right(2)
    move_left(2)
"""
print("start")
program = program.replace("\n","")
print(program)
command = ""
x = 0
y = 0
findex = -1
for l in program:
    if l not in ['(',')'] and not(l.isnumeric()):
        command += l
    #print(command)
    if command == "move_right":
        findex = program.index(l)
        #print(findex)
        if program[findex+2].isnumeric():
            x+=int(program[findex+2])
            program = program[findex+3:]
        else:
            x+=1
            program = program[findex+2:]
        command = ""
    if command == "move_left":
        findex = program.index(l)
        #print(findex)
        if program[findex+2].isnumeric():
            x-=int(program[findex+2])
            program = program[findex+3:]
        else:
            x-=1
            program = program[findex+2:]
        command = ""
    if command == "move_up":
        findex = program.index(l)
        #print(findex)
        if program[findex+2].isnumeric():
            y+=int(program[findex+2])
            program = program[findex+3:]
        else:
            y+=1
            program = program[findex+2:]
        command = ""
    if command == "move_down":
        findex = program.index(l)
        #print(findex)
        if program[findex+2].isnumeric():
            y-=int(program[findex+2])
            program = program[findex+3:]
        else:
            y-=1
            program = program[findex+2:]
        command = ""
print(x)
print(y)
